package com.cal.utms.action.maintenance;

import com.cal.utms.dao.maintenance.IssuerDaoImpl;
import com.cal.utms.dto.maintenance.IssuerTypeDto;
import com.cal.utms.model.maintenance.IssuerModel;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class IssuerTypeAction extends ActionSupport implements ModelDriven<IssuerTypeDto> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	IssuerDaoImpl daoImpl = new IssuerDaoImpl();
	private IssuerTypeDto issuerTypeDto = new IssuerTypeDto();
	private String categories;
	private boolean success;

	IssuerModel issuerModel = new IssuerModel();

	public String getAllIssuerType() {
		success = true;
		issuerTypeDto.setIssuerTypeDtos(IssuerModel.createIssuerTypeDtoList(daoImpl.getAllIssuerType()));
		return Action.SUCCESS;
	}

	public String saveCategory() {
		issuerModel.saveIssuerCategory(categories, issuerTypeDto);
		return Action.SUCCESS;
	}

	@Override
	public IssuerTypeDto getModel() {
		return issuerTypeDto;
	}

	public IssuerTypeDto getIssuerTypeDto() {
		return issuerTypeDto;
	}

	public void setIssuerTypeDto(IssuerTypeDto issuerTypeDto) {
		this.issuerTypeDto = issuerTypeDto;
	}

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public String getCategories() {
		return categories;
	}

	public void setCategories(String categories) {
		this.categories = categories;
	}

}
